﻿<Window x:Class="SelectionMaker.WindowUpdate"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:cv="clr-namespace:SelectionMaker"
    Title="New update available" Height="319" Width="463" Background="LightGray" WindowStartupLocation="CenterScreen" 
        Loaded="Window_Loaded" ShowInTaskbar="False">
    <Window.Resources>
        <XmlDataProvider Source="http://mahmoodramzani.persiangig.com/selectionmaker/SelectionMaker.xml"
                         x:Key="NewFeaturesDataSource"/>
        <cv:ConvertVersion x:Key="ConvertVersion"/>
    </Window.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="40"/>
            <RowDefinition/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>
        
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition/>
                <RowDefinition/>
            </Grid.RowDefinitions>
            
            <StackPanel Orientation="Horizontal">
                <TextBlock FontWeight="Bold">Version available: </TextBlock>
                <TextBlock>
                <TextBlock.Text>
                    <Binding Source="{StaticResource NewFeaturesDataSource}" XPath="/SelectionMaker/Version" Converter="{StaticResource ConvertVersion}"/>
                </TextBlock.Text>
                </TextBlock>
            </StackPanel>
            
            <StackPanel Grid.Row="1" Orientation="Horizontal">
                <TextBlock FontWeight="Bold">Release Date: </TextBlock>
                <TextBlock>
                <TextBlock.Text>
                    <Binding Source="{StaticResource NewFeaturesDataSource}" XPath="/SelectionMaker/ReleaseDate"/>
                </TextBlock.Text>
                </TextBlock>
            </StackPanel>
        </Grid>
        
        <ListBox Grid.Row="1">
            <ListBox.ItemsSource>
                <Binding Source="{StaticResource NewFeaturesDataSource}" XPath="/SelectionMaker/NewFeatures/Feature"/>
            </ListBox.ItemsSource>
            <ListBox.ItemContainerStyle>
                <Style TargetType="ListBoxItem">
                    <Setter Property="Margin" Value="0,2"/>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
       
        <Grid Grid.Row="2">
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            
            <Button Width="100" Height="25" Name="ButtonUpdate" Click="ButtonUpdate_Click">Go to Update Page</Button>
            <Button Width="70" Height="25" Grid.Column="1" Name="ButtonCancel" Click="ButtonCancel_Click">Cancel</Button>
        </Grid>
    </Grid>
</Window>
